package cc.rengu.igas.channel.cups.biz.impl;

import cc.rengu.igas.channel.cups.common.constant.CupsServiceConstant;
import cc.rengu.igas.channel.cups.common.enums.RespCodeEnum;
import cc.rengu.igas.channel.cups.facade.CupsPayService;
import cc.rengu.igas.channel.cups.facade.request.*;
import cc.rengu.igas.channel.cups.facade.response.*;
import cc.rengu.igas.channel.cups.facade.result.Result;
import cc.rengu.oltp.service.model.BizException;
import cc.rengu.oltp.service.model.DubboResult;
import cc.rengu.oltp.service.realize.DubboService;
import cc.rengu.oltp.service.realize.impl.DubboServiceImpl;
import cc.rengu.utility.log.RgLog;
import cc.rengu.utility.log.RgLogger;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;

@SuppressWarnings({"rawtypes", "unchecked"})
public class CupsPayServiceImpl extends CupsCommImpl implements CupsPayService {
    private RgLogger rglog = RgLog.getLogger(this.getClass().getName());

    @Override
    public Result<AcctBalanceQueryResponse> acctBalanceQuery(AcctBalanceQueryRequest acctBalanceQueryRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<AcctBalanceQueryResponse> result = new Result<>();
        AcctBalanceQueryResponse acctBalanceQueryResponse = new AcctBalanceQueryResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(acctBalanceQueryRequest,
                    CupsServiceConstant.ACCT_BALANCE_QUERY_SERVICE, AcctBalanceQueryResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((AcctBalanceQueryResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("余额查询失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                acctBalanceQueryResponse.setRespCode(((BizException) e).getCode());
                acctBalanceQueryResponse.setRespDesc(e.getMessage());
            } else {
                acctBalanceQueryResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                acctBalanceQueryResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<ConsumeResponse> consume(ConsumeRequest consumeRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ConsumeResponse> result = new Result<>();
        ConsumeResponse consumeResponse = new ConsumeResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(consumeRequest,
                    CupsServiceConstant.CONSUME_SERVICE, ConsumeResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ConsumeResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("消费失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                consumeResponse.setRespCode(((BizException) e).getCode());
                consumeResponse.setRespDesc(e.getMessage());
            } else {
                consumeResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                consumeResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<ConsumeRevsalResponse> consumeRevsal(ConsumeRevsalRequest consumeRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ConsumeRevsalResponse> result = new Result<>();
        ConsumeRevsalResponse consumeRevsalResponse = new ConsumeRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(consumeRevsalRequest,
                    CupsServiceConstant.CONSUME_REVSAL_SERVICE, ConsumeRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ConsumeRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("消费冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                consumeRevsalResponse.setRespCode(((BizException) e).getCode());
                consumeRevsalResponse.setRespDesc(e.getMessage());
            } else {
                consumeRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                consumeRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<ConsumeCancelResponse> consumeCancel(ConsumeCancelRequest consumeCancelRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ConsumeCancelResponse> result = new Result<>();
        ConsumeCancelResponse consumeCancelResponse = new ConsumeCancelResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(consumeCancelRequest,
                    CupsServiceConstant.CONSUME_CANCEL_SERVICE, ConsumeCancelResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ConsumeCancelResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("消费撤销失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                consumeCancelResponse.setRespCode(((BizException) e).getCode());
                consumeCancelResponse.setRespDesc(e.getMessage());
            } else {
                consumeCancelResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                consumeCancelResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<ConsumeCancelRevsalResponse> consumeCancelRevsal(ConsumeCancelRevsalRequest consumeCancelRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ConsumeCancelRevsalResponse> result = new Result<>();
        ConsumeCancelRevsalResponse consumeCancelRevsalResponse = new ConsumeCancelRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(consumeCancelRevsalRequest,
                    CupsServiceConstant.CONSUME_CANCEL_REVSAL_SERVICE, ConsumeCancelRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ConsumeCancelRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("消费撤销冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                consumeCancelRevsalResponse.setRespCode(((BizException) e).getCode());
                consumeCancelRevsalResponse.setRespDesc(e.getMessage());
            } else {
                consumeCancelRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                consumeCancelRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<ConsumeRefundResponse> consumeRefund(ConsumeRefundRequest consumeRefundRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ConsumeRefundResponse> result = new Result<>();
        ConsumeRefundResponse consumeRefundResponse = new ConsumeRefundResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(consumeRefundRequest,
                    CupsServiceConstant.CONSUME_REFUND_SERVICE, ConsumeRefundResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ConsumeRefundResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("消费退货失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                consumeRefundResponse.setRespCode(((BizException) e).getCode());
                consumeRefundResponse.setRespDesc(e.getMessage());
            } else {
                consumeRefundResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                consumeRefundResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthResponse> preAuth(PreAuthRequest preAuthRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthResponse> result = new Result<>();
        PreAuthResponse preAuthResponse = new PreAuthResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthRequest,
                    CupsServiceConstant.PREAUTH_SERVICE, PreAuthResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthResponse.setRespCode(((BizException) e).getCode());
                preAuthResponse.setRespDesc(e.getMessage());
            } else {
                preAuthResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthRevsalResponse> preAuthRevsal(PreAuthRevsalRequest preAuthRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthRevsalResponse> result = new Result<>();
        PreAuthRevsalResponse preAuthRevsalResponse = new PreAuthRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthRevsalRequest,
                    CupsServiceConstant.PREAUTH_REVSAL_SERVICE, PreAuthRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthRevsalResponse.setRespCode(((BizException) e).getCode());
                preAuthRevsalResponse.setRespDesc(e.getMessage());
            } else {
                preAuthRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthCancelResponse> preAuthCancel(PreAuthCancelRequest preAuthCancelRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthCancelResponse> result = new Result<>();
        PreAuthCancelResponse preAuthCancelResponse = new PreAuthCancelResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthCancelRequest,
                    CupsServiceConstant.PREAUTH_CANCEL_SERVICE, PreAuthCancelResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthCancelResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权撤销失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthCancelResponse.setRespCode(((BizException) e).getCode());
                preAuthCancelResponse.setRespDesc(e.getMessage());
            } else {
                preAuthCancelResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthCancelResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthCancelRevsalResponse> preAuthCancelRevsal(PreAuthCancelRevsalRequest preAuthCancelRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthCancelRevsalResponse> result = new Result<>();
        PreAuthCancelRevsalResponse preAuthCancelRevsalResponse = new PreAuthCancelRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthCancelRevsalRequest,
                    CupsServiceConstant.PREAUTH_CANCEL_REVSAL_SERVICE, PreAuthCancelRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthCancelRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权撤销冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthCancelRevsalResponse.setRespCode(((BizException) e).getCode());
                preAuthCancelRevsalResponse.setRespDesc(e.getMessage());
            } else {
                preAuthCancelRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthCancelRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthFinishResponse> preAuthFinish(PreAuthFinishRequest preAuthFinishRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthFinishResponse> result = new Result<>();
        PreAuthFinishResponse preAuthFinishResponse = new PreAuthFinishResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthFinishRequest,
                    CupsServiceConstant.PREAUTH_FINISH_SERVICE, PreAuthFinishResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthFinishResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权完成失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthFinishResponse.setRespCode(((BizException) e).getCode());
                preAuthFinishResponse.setRespDesc(e.getMessage());
            } else {
                preAuthFinishResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthFinishResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthFinishRevsalResponse> preAuthFinishRevsal(PreAuthFinishRevsalRequest preAuthFinishRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthFinishRevsalResponse> result = new Result<>();
        PreAuthFinishRevsalResponse preAuthFinishRevsalResponse = new PreAuthFinishRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthFinishRevsalRequest,
                    CupsServiceConstant.PREAUTH_FINISH_REVSAL_SERVICE, PreAuthFinishRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthFinishRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权完成冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthFinishRevsalResponse.setRespCode(((BizException) e).getCode());
                preAuthFinishRevsalResponse.setRespDesc(e.getMessage());
            } else {
                preAuthFinishRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthFinishRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthFinishCancelResponse> preAuthFinishCancel(PreAuthFinishCancelRequest preAuthFinishCancelRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthFinishCancelResponse> result = new Result<>();
        PreAuthFinishCancelResponse preAuthFinishCancelResponse = new PreAuthFinishCancelResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthFinishCancelRequest,
                    CupsServiceConstant.PREAUTH_FINISH_CANCEL_SERVICE, PreAuthFinishCancelResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthFinishCancelResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权完成撤销失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthFinishCancelResponse.setRespCode(((BizException) e).getCode());
                preAuthFinishCancelResponse.setRespDesc(e.getMessage());
            } else {
                preAuthFinishCancelResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthFinishCancelResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<PreAuthFinishCancelRevsalResponse> preAuthFinishCancelRevsal(PreAuthFinishCancelRevsalRequest preAuthFinishCancelRevsalRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<PreAuthFinishCancelRevsalResponse> result = new Result<>();
        PreAuthFinishCancelRevsalResponse preAuthFinishCancelRevsalResponse = new PreAuthFinishCancelRevsalResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(preAuthFinishCancelRevsalRequest,
                    CupsServiceConstant.PREAUTH_FINISH_CANCEL_REVSAL_SERVICE, PreAuthFinishCancelRevsalResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((PreAuthFinishCancelRevsalResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("预授权完成撤销冲正失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                preAuthFinishCancelRevsalResponse.setRespCode(((BizException) e).getCode());
                preAuthFinishCancelRevsalResponse.setRespDesc(e.getMessage());
            } else {
                preAuthFinishCancelRevsalResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                preAuthFinishCancelRevsalResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<AcctBalanceQueryResponse> cupsAcctBalanceQueryService(AcctBalanceQueryRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<EnchashmentResponse> cupsEnchashmentService(CupsACRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<EnchashmentRevsalResponse> cupsEnchashmentRevsalService(EnchashmentRevsalRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<DepositResponse> cupsDepositService(DepositRequest request) throws Exception {
        return callService(request);
    }


    @Override
    public Result<DepositCancelResponse> cupsDepositCancelService(DepositCancelRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<DepositConfirmResponse> cupsDepositConfirmService(DepositConfirmRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<DepositCancelRevsalResponse> cupsDepositCancelRevsalService(DepositCancelRevsalRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<AcctVerifyResponse> cupsAcctVerifyService(AcctVerifyRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TrapResponse> cupsTrapService(TrapRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TrapRevsalResponse> cupsTrapRevsalService(TrapRevsalRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TransferTrapResponse> cupsTransferTrapService(TransferTrapRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TransferTrapRevsalResponse> cupsTransferTrapRevsalService(TransferTrapRevsalRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TransferResponse> cupsTransferService(TransferRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TransferOutCancelResponse> cupsTransferOutCancelService(TransferOutCancelRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<ScriptResultNoticeResponse> scriptResultNotice(ScriptResultNoticeRequest scriptResultNoticeRequest) {
        DubboService dubboService = new DubboServiceImpl();
        Result<ScriptResultNoticeResponse> result = new Result<>();
        ScriptResultNoticeResponse scriptResultNoticeResponse = new ScriptResultNoticeResponse();
        try {
            DubboResult dubboResult = dubboService.callAtomService(scriptResultNoticeRequest,
                    CupsServiceConstant.SCRIPTRESULTNOTICE_SERVICE, ScriptResultNoticeResponse.class);
            result.setSuccess(dubboResult.isSuccess());
            result.setResult((ScriptResultNoticeResponse) dubboResult.getResult());
        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("脚本通知失败:<{}>", byteArrayOutputStream.toString());
            result.setSuccess(false);
            if (e instanceof BizException) {
                scriptResultNoticeResponse.setRespCode(((BizException) e).getCode());
                scriptResultNoticeResponse.setRespDesc(e.getMessage());
            } else {
                scriptResultNoticeResponse.setRespCode(RespCodeEnum.SYSTEM_ERROR.getRespCode());
                scriptResultNoticeResponse.setRespDesc(RespCodeEnum.SYSTEM_ERROR.getRespDesc());
            }
        }
        return result;
    }

    @Override
    public Result<SignResultNoticeResponse> cupsSignResultNoticeService(SignResultNoticeRequest request) throws Exception {
        return callService(request);
    }

    @Override
    public Result<TokenSignOffNoticeResponse> tokenSignOffNoticeService(TokenSignOffNoticeRequest request) throws Exception {
        return callService(request);
    }

}
